import { Badge } from 'antd';
import React from 'react';

import { ColumnFieldBase } from '../../../typings/ColumnFieldBase';

type EnumColumnFieldProps = ColumnFieldBase & {};

const EnumColumnField: React.FC<EnumColumnFieldProps> = (props) => {
  const { value, dataSource } = props;
  const data = dataSource?.find((item: any) => item.value === value);
  return (
    <span>
      {data?.status ? <Badge status={data?.status} /> : null}
      {data?.label}
    </span>
  )
}

export {
  EnumColumnFieldProps,
  EnumColumnField
}
